﻿<Page
    x:Class="VivendoByteToolkit.Sample.MainPage2"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:VivendoByteToolkit.Sample"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="using:VivendoByteToolkit.Sample.ViewModel"
    xmlns:helper="using:VivendoByteToolkit.Helpers"
    xmlns:ctl="using:VivendoByteToolkit.Controls"
    mc:Ignorable="d"
    Background="White">

    <Page.Resources>
        <vm:MainViewModel2 x:Key="viewmodel" />
    </Page.Resources>

    <Canvas DataContext="{StaticResource viewmodel}" Background="White">
        <TextBlock Text="{Binding Caption}" Foreground="Black" FontSize="64" Canvas.Left="20" Canvas.Top="20" />
        
        <Border Background="DarkBlue" Width="300" Height="300" Canvas.Left="600" Canvas.Top="100"
                helper:DragAndDropCommandHelper.TargetCommand="{Binding DropCommand}">
            <TextBlock Text="{Binding DraggedItem}" Foreground="White" FontSize="28" HorizontalAlignment="Center" VerticalAlignment="Center"  />
        </Border>

        <Border Background="DarkBlue" Width="100" Height="100" Canvas.Left="300" Canvas.Top="100"
                helper:DragAndDropCommandHelper.OverCommand="{Binding OverCommand}">
        </Border>

        <GridView ItemsSource="{Binding Items}" CanReorderItems="True" CanDragItems="True" Canvas.Top="300"
                  SelectionMode="Single" SelectedItem="{Binding SelectedItem,Mode=TwoWay}"
                  helper:DragAndDropCommandHelper.SourceCommand="{Binding StartDragCommand}">
            <GridView.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}" Foreground="Black" FontSize="20" />
                </DataTemplate>
            </GridView.ItemTemplate>
        </GridView>
        
    </Canvas>
</Page>